package ch.nostromo.tiffanys.game.game;

public class GameState {

  public static final int STATE_GAME_OPEN = 0;
  
  public static final int STATE_WHITE_CHECKS = 1;
  public static final int STATE_BLACK_CHECKS = 1;
  
  public static final int STATE_WHITE_MATES = 10;
  public static final int STATE_BLACK_MATES = 11;
  
  public static final int STATE_REMIS_BY_STALE_MATE = 20;
  public static final int STATE_REMIS_BY_MATERIAL = 21;
  public static final int STATE_REMIS_BY_THREE = 22;
  public static final int STATE_REMIS_BY_FIFTY = 23;
  
  private int state = STATE_GAME_OPEN;

  public GameState() {
    // Do nothing
 
  }
  
  public GameState(int state) {
    this.state = state;
  }

  public int getState() {
    return state;
  }

  public void setState(int state) {
    this.state = state;
  }
  
  public boolean gameOpen() {
    return (getState() == STATE_GAME_OPEN || getState() == STATE_WHITE_CHECKS || getState() == STATE_BLACK_CHECKS);
  }
  
  public boolean isCheck() {
    return (getState() == STATE_WHITE_CHECKS || getState() == STATE_BLACK_CHECKS);
  }
  
  public boolean whiteMates() {
    return (getState() == STATE_WHITE_MATES);
  }
  
  public boolean blackMates() {
    return (getState() == STATE_BLACK_MATES);
  }
  
  public boolean remisByMaterial() {
    return (getState() == STATE_REMIS_BY_MATERIAL);
  }
  
  public boolean remisByThree() {
    return (getState() == STATE_REMIS_BY_THREE);
  }
  
  public boolean remisByFifty() {
    return (getState() == STATE_REMIS_BY_FIFTY);
  }
  
  public boolean remisByStaleMate() {
    return (getState() == STATE_REMIS_BY_STALE_MATE);
  }
  
}
